using cuberga.Utils;
using System.Collections.Generic;
using System.Text;

namespace cuberga.GA.Permutation
{
    public class PermutationGenotype: Genotype 
    {
            private Utils.Permutation _permutation;

            public PermutationGenotype()
                : this(0)
            {
            }

            public PermutationGenotype(int valuesCount): base()
            {
                _permutation = new Utils.Permutation(valuesCount);
                //_permutation.Shuffle();
            }

            public PermutationGenotype(int[] rgSourceArray)
            {
                _permutation = new Utils.Permutation(rgSourceArray);
            }

            public override void FromStructure(object sourceStructure)
            {
                // TODO use clone()!!!!
                _permutation = new Utils.Permutation((int[])sourceStructure);
            }

            public override object ToStructure()
            {
                return _permutation.ToStructure;
            }

            public int[] ToArray()
            {
                return (int[])ToStructure();
            }
        }
}
